﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using Thaire.Investment.BL.DTO;
using Thaire.Investment.BL.ScreenData;
using Thaire.Investment.Domains.Transaction;
using Thaire.Investment.BL.Filter;
using Thaire.Investment.Domains.Master;

namespace Thaire.Investment.BL
{
    [ServiceContract]
    public interface IInvestmentService
    {
        #region common

        [OperationContract]
        DateTime GetSystemDateTime();

        [OperationContract]
        IList<CounterParties> GetAllCounterPaties();

        [OperationContract]
        IList<PaymentType> GetAllPaymentTypes();

        [OperationContract]
        IList<Bank> GetBranchByBankID(string bankCode);

        [OperationContract]
        IList<string> GetEquityFullNameTH();

        [OperationContract]
        IList<string> GetEquityFullNameEN();

        [OperationContract]
        List<FundName> GetFundThNamesByName(string fundThName);

        [OperationContract]
        List<FundName> GetFundEnNamesByName(string fundEnName);

        [OperationContract]
        int? GetRiskLevel(RatingHistory rateHistory);

        #endregion

        #region Instrument --> Fixed Income Securities

        [OperationContract]
        List<RatingHistoryViewDTO> GetRatingHistory(int instrumentID, String instrumentType);

        [OperationContract]
        FixincomesecuritiesAmortizeSchedule InsertAmortizeSchedule(FixincomesecuritiesAmortizeSchedule data);

        [OperationContract]
        void DeleteAmortizeSchedule(int amortizeScheduleID);

        [OperationContract]
        AmortizeScheduleScreenData GetAmortizeScheduleScreenData(int headerID);

        [OperationContract]
        FixIncomePurchaseScreenData GetFixIncomePurchaseScreenData();


        [OperationContract]
        AmortizeScreenData GenerateAmortize(int fixIncomePurchaseID);

        [OperationContract]
        FixIncomeSecuritiesDTO InsertFixIncomeHeader(FixIncomeSecuritiesDTO data);

        [OperationContract]
        FixIncomeSecuritiesDTO UpdateFixIncomeHeader(FixIncomeSecuritiesDTO data);

        [OperationContract]
        List<FixIncomeSecuritiesHeader> SearchFiexdIncome(SearchFiexdIncomeFilter searchData);

        [OperationContract]
        FixIncomeSecuritiesDTO GetFixIncomeHeaderByID(int id);

        [OperationContract]
        FixedIncomeListData GetFixedIncomeListScreenData();

        [OperationContract]
        List<FixincomesecuritiesPurchase> GetFixIncomePurchasesByHeaderId(int headerId);

        [OperationContract]
        FixIncomeSecuritiesHeader GetFixedIncomeSecuritiesHeaderById(int headerId);

        [OperationContract]
        FixincomesecuritiesPurchase InsertFixedIncomePurchase(FixincomesecuritiesPurchase fixincomesecuritiesPurchase);

        [OperationContract]
        FixedIncomeHeaderScreenData GetFixedIncomeHeaderScreenData();

        [OperationContract]
        FixincomesecuritiesPurchaseDTO GetFixIncomePurchaseByID(int purchaseID);

        [OperationContract]
        FixIncomeSecuritiesTransactionScreenData GetFixIncomeSecuritiesTransactionScreenData(int purchaseID, int? transactionID);

        [OperationContract]
        FixIncomeSecuritiesTransaction InsertFixIncomeSecuritiesTransaction(FixIncomeSecuritiesTransaction transaction);

        [OperationContract]
        FixIncomeSecuritiesTransactionDTO GetFixIncomeSecuritiesTransactionDTO(int transactionID);

        [OperationContract]
        FixIncomeSecuritiesTransaction UpdateFixIncomeSecuritiesTransaction(FixIncomeSecuritiesTransaction transaction);

        [OperationContract]
        FixincomesecuritiesPurchase UpdateFixincomesecuritiesPurchase(FixincomesecuritiesPurchase purchase);

        #endregion

        #region Instrument --> Unit Trust

        [OperationContract]
        UnitTrustProportion InsertUnitTrustProportion(UnitTrustProportion data);

        [OperationContract]
        UnitTrustProportion UpdateUnitTrustProportion(UnitTrustProportion data);

        [OperationContract]
        UnitTrustProportionScreenData GetUnitTrustProportionScreenData(int? headerId, int? proportionId);

        [OperationContract]
        UnitTrustHeaderDTO InsertUnitTrustHeader(UnitTrustHeader data);

        [OperationContract]
        UnitTrustHeaderDTO UpdateUnitTrustHeader(UnitTrustHeader data);

        [OperationContract]
        UnitTrustHeaderScreenData GetUnitTrustHeaderScreenData(int? headerId);

        [OperationContract]
        UnitTrustTransaction InsertUnitTrustTransaction(UnitTrustTransaction data);

        [OperationContract]
        UnitTrustTransaction UpdateUnitTrustTransaction(UnitTrustTransaction data);

        [OperationContract]
        UnitTrustTransactionScreenData GetUnitTrustTransactionScreenData(int? headerId, int? transactionId, string transactionType);

        [OperationContract]
        List<UnitTrustHeader> SearchUnitTrust(SearchUnitTrustFilter searchData);

        [OperationContract]
        UnitTrustPrivilegeScreenData GetUnitTrustPrivilegeScreenData(int? headerId, int? privilegeId);

        [OperationContract]
        UnitTrustHeaderDTO GetPrivilegeDataByHeaderId(int headerId);

        [OperationContract]
        UnitTrustPrivilege UpdateUnitTrustPrivilege(UnitTrustPrivilege data);

        [OperationContract]
        UnitTrustPrivilege InsertUnitTrustPrivilege(UnitTrustPrivilege data);

        #endregion

        #region Instrument --> Equity

        [OperationContract]
        List<EquityHeader> SearchEquity(SearchEquityFilter searchData);

        [OperationContract]
        EquityHeaderScreenData GetEquityHeaderScreenData(int? headerId);

        [OperationContract]
        EquityHeaderDTO InsertEquityHeader(EquityHeader data);

        [OperationContract]
        EquityHeaderDTO UpdateEquityHeader(EquityHeader data);

        [OperationContract]
        EquityTransaction InsertEquityTransaction(EquityTransaction data);

        [OperationContract]
        EquityTransaction UpdateEquityTransaction(EquityTransaction data);

        [OperationContract]
        EquityTransactionScreenData GetEquityTransactionScreenData(int? headerId, int? transactionId, string transactionType);

        [OperationContract]
        EquityHeaderDTO GetEquityPrivilegeDataByHeaderId(int headerId);

        [OperationContract]
        EquityPrivilegeScreenData GetEquityPrivilegeScreenData(int? headerId, int? privilegeId);

        [OperationContract]
        EquityPrivilege InsertEquityPrivilege(EquityPrivilege data);

        [OperationContract]
        EquityPrivilege UpdateEquityPrivilege(EquityPrivilege data);
        #endregion

        #region Instruction

        [OperationContract]
        ManageInstructionScreenData GetManageInstructionScreenData();

        [OperationContract]
        List<ManageInstructionDTO> SearchInstructionDTO(SearchInstructionFilter filter);

        [OperationContract]
        InstructionFormScreenData GetInstructionFormScreenData(int headerID);

        [OperationContract]
        List<InstructionDataDTO> InstructionGetSelectionFixincomeData(InstructionFormScreenData formData);

        [OperationContract]
        List<InstructionUnitTrustGridDetail> InstructionGetSelectionUnitTrustData(InstructionFormScreenData formData);


        [OperationContract]
        List<InstructionDepositAtFinancialGridDetail> InstructionGetSelectionDepositData(InstructionFormScreenData formData);

        [OperationContract]
        InstructionFormScreenData SaveInstructionDeposit(InstructionHeader header, List<DepositInstructionDetail> detail);


        [OperationContract]
        void DeleteInstructionFixIncome(int[] delID);

        [OperationContract]
        void DeleteInstructionDeposit(int[] delID);

        [OperationContract]
        void DeleteInstructionUnitTrust(int[] delID);

        [OperationContract]
        void DeleteInstructionEquity(int[] delID);

        [OperationContract]
        List<InstructionEquityGridDetail> InstructionGetSelectionEquity(InstructionFormScreenData formData);

        [OperationContract]
        InstructionFormScreenData SaveInstructionFixIncome(InstructionHeader header, List<InstructionDetail> detail);

        [OperationContract]
        InstructionFormScreenData SaveInstructionUnitTrust(InstructionHeader header, List<UnitTrustInstructionDetail> detail);

        [OperationContract]
        InstructionFormScreenData SaveInstructionEquity(InstructionHeader header, List<EquityInstructionDetail> detail);
        #endregion

        #region Instrument --> Deposit

        [OperationContract]
        List<DepositHeaderDTO> SearchDeposit(SearchDepositFilter searchData);

        [OperationContract]
        DepositHeaderScreenData GetDepositHeaderScreenData(int? headerId);

        [OperationContract]
        DepositHeaderDTO InsertDepositHeader(DepositHeaderDTO headerDTO);

        [OperationContract]
        DepositInterest InsertDepositInterest(DepositInterest data);

        [OperationContract]
        void DeleteDepositInterest(int interestID);

        [OperationContract]
        DepositHeaderDTO UpdateDepositHeader(DepositHeaderDTO headerDTO);

        [OperationContract]
        DepositTransaction InsertDepositTransaction(DepositTransaction data);

        [OperationContract]
        DepositTransaction UpdateDepositTransaction(DepositTransaction data);

        [OperationContract]
        DepositTransactionScreenData GetDepositTransactionScreenData(int? headerId, int? transactionId, string transactionType);

        [OperationContract]
        DepositInterestScreenData GetDepositInterestScreenData(int headerId);

        #endregion


        #region Instrument --> Loan

        [OperationContract]
        LoanExtraInstallmentScreenData GetLoanExtraInstallmentScreenData(int? headerId, int? extraInstallmentId);
        [OperationContract]
        LoansExtrainstallment UpdateLoansExtrainstallment(LoansExtrainstallment data);
        [OperationContract]
        LoansExtrainstallment InsertLoansExtrainstallment(LoansExtrainstallment data);
        [OperationContract]
        LoanHeaderDTO UpdateLoanHeader(LoansHeader data);
        [OperationContract]
        LoanHeaderDTO InsertLoanHeader(LoansHeader data);
        [OperationContract]
        LoanHeaderScreenData GetLoanHeaderScreenData(int? headerId, bool isSearchMode);
        [OperationContract]
        List<LoansHeader> SearchLoans(SearchLoanFilter filter);

        [OperationContract]
        LoanInterestRateScreenData GetLoanInterestRateScreenData(int? headerId);
        [OperationContract]
        LoansInterestDetail InsertInterestRateDetail(LoansInterestDetail detail);
        [OperationContract]
        LoansInterestDetail UpdateInterestRateDetail(LoansInterestDetail data);
        [OperationContract]
        AmortizeLoanScheduleScreenData GetAmortizeLoanScheduleScreenData(int interestDetailID);

        #endregion

    }
}
